<template>
  <div>
    <h1>vuex讲解父组件</h1>
    <router-link to="/vuex/vxone">one</router-link>|
    <router-link to="/vuex/vxtwo">two</router-link>
    <h1>{{ fdata }}</h1>
    <button @click="getChild">获取子组件</button>
    <hr />

    <router-view></router-view>
  </div>
</template>
<script>
export default {
  data () {
    return {
      fdata: '今天星期五',
      age: 18,
      city: '廊坊'
    }
  },
  provide () {
    return {
      cityname: this.city
    }
  },
  methods: {
    getChild () {
      // this.$children 获取子组件的集合
      //操作子组件的数据 和方法 给子组件传递数据
      console.log(this.$children)
      this.$children[2].twoData = '老七烧烤'
    },
    run (msg) {
      alert(msg)
    }
  }
}
</script>
<style lang="less"></style>
